<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<jsp:include page="/includes/top.jsp"></jsp:include>
<div class="page-header">
	<h1></h1>
</div>
<!-- /.page-header -->
<div class="row">
	<div class="col-xs-12">
		<div class="col-sm-6">
			<div class="row">
				<div
					class="col-xs-11 label label-lg label-info arrowed-in arrowed-right">
					<b>详细信息</b>
				</div>
			</div>
			<div class="row">
				<ul class="list-unstyled spaced" id="divul">
					<li><i class="icon-caret-right blue"></i>项目名称:&nbsp;&nbsp;&nbsp;<b class="c1"></b></li>
					<li><i class="icon-caret-right blue"></i>任务名称:&nbsp;&nbsp;&nbsp;<b class="c2"></b></li>
					<li><i class="icon-caret-right blue"></i>开始时间:&nbsp;&nbsp;&nbsp;<b class="c3"></b></li>
					<li><i class="icon-caret-right blue"></i>结束时间:&nbsp;&nbsp;&nbsp;<b class="c4"></b></li>
					<li><i class="icon-caret-right blue"></i>已进行小时数:&nbsp;&nbsp;&nbsp;<b class="c5"></b></li>
					<li><i class="icon-caret-right blue"></i>完成百分比:&nbsp;&nbsp;&nbsp;<b class="c6"></b></li>
					<li><i class="icon-caret-right blue"></i>父任务:&nbsp;&nbsp;&nbsp;<b class="c7"></b></li>
				</ul>
			</div>
		</div>
		<!-- /span -->
		<div class="col-sm-6">
			<div class="row">
				<div
					class="col-xs-11 label label-lg label-success arrowed-in arrowed-right">
					<b>概要</b>
				</div>
			</div>
			<div>
				<ul class="list-unstyled spaced">
					<li><i class="icon-caret-right blue"></i>任务类型:&nbsp;&nbsp;&nbsp;<b class="t1"></b></li>
					<li><i class="icon-caret-right blue"></i>状态:&nbsp;&nbsp;&nbsp;<b class="t2"></b></li>
					<li><i class="icon-caret-right blue"></i>优先级:&nbsp;&nbsp;&nbsp;<b class="t3"></b></li>
					<li><i class="icon-caret-right blue"></i>任务描述:&nbsp;&nbsp;&nbsp;<b class="t4"></b></li>
				</ul>
			</div>
		</div>
		<!-- /span -->
	</div>
</div>
<div class="row">
	<div class="col-xs-12">
		<ul class="nav nav-tabs">
			<li class="active"><a href="#tabs-1" data-toggle="tab">任务日志</a></li>
		</ul>
		<div class="tab-content">
			<div id="tabs-1" class="tab-pane fade in active">
				<div class="table-responsive">
					<table id="gb-1"
						class="table table-striped table-bordered table-hover"
						style="width:100%">
						<thead>
							<tr>
								<th style="width:2%"><input type="checkbox" id="checkAll"
									class="ace"><span class="lbl"></span></th>
								<th style="width:10%">创建日期</th>
								<th style="width:20%">日志名称</th>
								<th style="width:35%">日志描述</th>
								<th style="width:10%">日志类型</th>
								<th style="width:10%">创建人</th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/includes/bottom.jsp"></jsp:include>

<Script type="text/javascript">
	var tid = getQueryString("id");
	var dataMap = {'task.taskId' : tid};
	$.ajax({
		type : "post",
		url : "gettask",
		data : dataMap,
		dataType : "json",
		success : function(data) {
			if (typeof (data) == "object") {
				$(".c1").html(data.taskProjectName);
				$(".c2").html(data.taskName);
				$(".c3").html(data.taskStartDate);
				$(".c4").html(data.taskEndTime);
				$(".c5").html(data.taskHoursWorked);
				$(".c6").html(data.taskPercentComplete);
				$(".c7").html(data.taskParentName);

				$(".t1").html(data.taskTypeName);
				$(".t2").html(data.taskStatusName);
				$(".t3").html(data.taskProjectName);
				$(".t4").html(data.taskDescription);
			}
		}
	});
	
	var columns = [
		{
			"data" : "taskLogId",
			"fnCreatedCell" : function(nTd, sData, oData, iRow, iCol) {
				$(nTd).html("<input type='checkbox' name='checkList' value='" + sData + "' class='ace'><span class='lbl'></span>");
			}
		},
		{"data" : "createLogDate"},  
		{"data" : "taskLogName"}, 
		{"data" : "taskLogDescription"}, 
		{
			"data" : "taskLogType",
			"fnCreatedCell" : function(nTd, sData, oData, iRow, iCol) {
				var txt = sData=='0'?"一般日志":"问题报告";	$(nTd).html(txt);
			}
		}, 
		{"data" : "taskLogCreator.sysUserinfo.userinfoTruename"}];
	//参数说明：id,url,data,column,length			
	tableload("gb-1","tasklogid",{tid : tid},columns,8);

	function getSelected() {
		var str = '';
		$("input[name='checkList']:checked").each(function() {
			str += $(this).val();
			str += ",";
		});
		str = str.substr(0, str.length - 1);
		return str;
	}
	function _addFun() {
		window.open("tasklogform?m=" + mid + "&tasklog.taskId=" + tid, "_self");
	}
	function _editFun(){
		var str = getSelected();
		if (str != '' && str.indexOf(",") < 0) {
			window.open("tasklogform?m=" + mid + "&tasklog.taskId=" + tid + "&tasklog.taskLogId=" + str, "_self");
		} else {
			alert("请选择一条记录操作");
		}
	}
	function _delFun(){
		var str = getSelected();
		if (str.length > 0) {
			if (confirm("确定要删除数据吗？")) {
				$.ajax({
					type : "post",
					url : "deltasklog",
					data : {'tasklog.taskLogId': str},
					success : function(data) {
					    showDelMessage(data);
						window.open("Task/taskDetail.jsp?m=" + mid + "&id=" + tid, "_self");
					}
				});
			}
		} else {
			alert("请选择一条记录操作");
		}
	}
	
</Script>
